package com.cksys.achievement.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cksys.achievement.enums.ResultStatus;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * @author tadechen
 * @since 2019-09-26
 */
@Data
@Accessors(chain = true)
@TableName(value = "result", resultMap = "selectAllFiled")
public class Result {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 成果名称
     */
    @NotEmpty
    private String name;

    /**
     * 成果简介
     */
    @NotEmpty
    private String info;

    /**
     * 成果获得时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd", timezone="GMT+8")
    private Date getTime;

    /**
     * 成果类型id
     */
    private Integer typeId;

    /**
     * 成果是否隐藏0 不 1 隐藏
     */
    private Boolean isHidden;

    /**
     * 成果是否在个人主页置顶0 不 1 置顶
     */
    private Boolean isTop;

    /**
     * 成果分数
     */
    private Integer score;

    /**
     * 成果插入时间
     */
    private LocalDateTime insertTime;

    /**
     * 成果所属用户id
     */
    private Integer uId;

    /**
     * 成果链接
     */
    private String link;

    /**
     * 审核状态
     */
    private ResultStatus resultStatus;

    @TableField(exist = false)
    private List<User> userList;

    @TableField(exist = false)
    private List<ResultPicture> resultPictureList;

    @TableField(exist = false)
    private Type type;

}
